Skip to content

Migrate Compose touch and input snippets - #1118

Open
pengzhi-cb wants to merge 9 commits into
android:mainfrom
pengzhi-cb:pengzhi-cb/compose-migrate-swipeable
Open

pengzhi-cb wants to merge 9 commits into
android:mainfrom
pengzhi-cb:pengzhi-cb/compose-migrate-swipeable

Conversation

@pengzhi-cb

@pengzhi-cb pengzhi-cb commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Code snippets are for:

  1. (3 snippets) https://developer.android.com/develop/ui/compose/touch-input/scroll/nested-scroll-modifiers

Total: 3 code snippets (3 Kotlin and 0 XML) across 1 page.

Resource migration notes
  1. Three untagged supporting XML layout files (view_in_compose_nested_scroll_interop.xml, list_item.xml, and fragment_bottom_sheet.xml) were added to compose/snippets/src/main/res/layout/ because the tagged Kotlin snippets in GesturesSnippets.kt reference their resource symbols (R.layout.view_in_compose_nested_scroll_interop, R.id.main_list, R.layout.list_item, R.layout.fragment_bottom_sheet, and R.id.compose_view) and will not compile without them.
  2. All three layout file names and view IDs were forced directly by the inflate(...) and findViewById(...) calls in the guide page code blocks.
List of modifications
  1. Nested-scroll-modifiers page: Added required title = {}, parameter to TopAppBar(...) and replaced the trailing // ... comment in NestedScrollInteropAdapter with // [START_EXCLUDE] override fun getItemCount(): Int = items.size // [END_EXCLUDE] in NestedScrollInteropComposeParentWithAndroidChildExample (android_compose_touchinput_scroll_nested_scroll_interop_compose_parent) so the snippet compiles.
  2. Nested-scroll-modifiers page: Replaced non-existent android.R.layout.list_item with R.layout.list_item in ViewInComposeNestedScrollInteropExample (android_compose_touchinput_scroll_view_in_compose_interop) (Required for the Kotlin snippet to compile) and formatted scrollable(...) arguments across lines.
  3. Nested-scroll-modifiers page: Added untagged supporting XML layout resources view_in_compose_nested_scroll_interop.xml, list_item.xml, and fragment_bottom_sheet.xml under compose/snippets/src/main/res/layout/ (Required for the Kotlin snippet to compile).
Snippets not migrated
  1. Nested-scroll-modifiers page:
    1. None (all 3 remaining hardcoded code blocks on the guide page were migrated; lines 295–301 already reference touchinput_gestures_nested_scroll_interop.xml on GitHub via {% includecode %}).

@pengzhi-cb pengzhi-cb changed the title Migrate Migrate from Swipeable to AnchoredDraggable snippets Migrate Compose touch and input snippets Sep 18, 2026
@pengzhi-cb
pengzhi-cb force-pushed the pengzhi-cb/compose-migrate-swipeable branch from a0a6981 to aa14dc4 Compare September 29, 2026 21:56
@pengzhi-cb pengzhi-cb changed the title Migrate Compose touch and input snippets Migrate Snippet: Compose touch and input Sep 29, 2026
@pengzhi-cb
pengzhi-cb marked this pull request as ready for review September 29, 2026 22:08
@pengzhi-cb
pengzhi-cb requested a review from a team as a code owner September 29, 2026 22:08
@snippet-bot

snippet-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@pengzhi-cb pengzhi-cb changed the title Migrate Snippet: Compose touch and input Migrate Compose touch and input snippets Sep 30, 2026
edward-williams-stellarelements pushed a commit to StellarElements/android-dac-snippets that referenced this pull request Oct 5, 2026
The nested-scroll-modifiers page was queued twice, and it's already
migrated in android#1118. Both pull requests add the same
layout files, so this branch leaves the page to android#1118:

- GesturesSnippets.kt goes back to main. The three new interop region
  tags, their imports, and the @OptIn on NestedScrollInterop are
  removed, and the stand-in object R that backs the existing
  interop_activity region is restored.
- The four layouts that were added only for those snippets are
  removed: activity_main, fragment_bottom_sheet, list_item, and
  view_in_compose_nested_scroll_interop.
edward-williams-stellarelements added a commit to StellarElements/android-dac-snippets that referenced this pull request Oct 5, 2026
The nested-scroll-modifiers page was queued twice, and it's already
migrated in android#1118. Both pull requests add the same
layout files, so this branch leaves the page to android#1118:

- GesturesSnippets.kt goes back to main. The three new interop region
  tags, their imports, and the @OptIn on NestedScrollInterop are
  removed, and the stand-in object R that backs the existing
  interop_activity region is restored.
- The four layouts that were added only for those snippets are
  removed: activity_main, fragment_bottom_sheet, list_item, and
  view_in_compose_nested_scroll_interop.

@kkuan2011 kkuan2011 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good once comments addressed

@pengzhi-cb
pengzhi-cb force-pushed the pengzhi-cb/compose-migrate-swipeable branch from db5db01 to 1f9b9e9 Compare October 8, 2026 21:33
@pengzhi-cb
pengzhi-cb force-pushed the pengzhi-cb/compose-migrate-swipeable branch from dff1ab1 to f7e993e Compare October 9, 2026 15:31

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants